﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Reflection;

[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]

public class VersionAttribute : System.Attribute
{
    private string name;
    private string comment;

    public VersionAttribute(string name, string comment)
    {
        this.name = name;
        this.comment = comment;
    }

    public VersionAttribute(string name)
    {
        this.name = name;
    }

    public string Name
    {
        get
        {
            return this.name;
        }
    }
    public string Comment
    {
        get
        {
            return this.comment;
        }
    }
}

public class VersionsInAction
{
    [VersionAttribute("what?")]
    public static void SayWhat()
    {
        Console.WriteLine("whaaaat?");
    }

    [VersionAttribute("Hi?!?","whaat?")]
    public static void SayHi()
    {
        Console.WriteLine("Hi!");
    }

    static void Main()
    {
        Type type = typeof(VersionsInAction);
        var methods = type.GetMethods();
        foreach (var method in methods)
        {   
            object[] allAttributes = method.GetCustomAttributes(false);
            foreach (Attribute attrib in allAttributes)
            {
                if (attrib is VersionAttribute)
                {
                    VersionAttribute attribute = (VersionAttribute)attrib;
                    Console.WriteLine("{0} {1} ", attribute.Name, attribute.Comment);
                }
            }
        }
    }
}